﻿@{
    ViewBag.Title = "IncomReserationView";
}
@using WeiXinWeb.Models;
@model InConsignationDetail


<style type="text/css">
    .custom-corners .ui-bar {
        -webkit-border-top-left-radius: inherit;
        border-top-left-radius: inherit;
        -webkit-border-top-right-radius: inherit;
        border-top-right-radius: inherit;
    }

    .custom-corners .ui-body {
        border-top-width: 0;
        -webkit-border-bottom-left-radius: inherit;
        border-bottom-left-radius: inherit;
        -webkit-border-bottom-right-radius: inherit;
        border-bottom-right-radius: inherit;
    }
</style>
<script type="text/javascript">
    $(function () {
        var mm=message();
        $("#res").click(function () {
           var cc = $("#carnumber option:selected").text();
           var price = $("#price");
           if (cc == "")
           {
               mm.update("没有选择车辆！").show("")
               return false;
           }
           if ($.trim(price.val()) == "")
           {
               mm.update("请输入运费报价！").show("")
               price.focus()
               return false;
           }
           var sel = $("#last").find("select")
           var cc = $(sel[0]).val() +" "+ $(sel[1]).val();
           cc=cc.substring(3, cc.length);
           parm = $("#subform").serialize() + "&LastDt=" + cc;
           $.post("/Reservation/Save", parm, function (data) {
               if (data != null)
               {
                   if (data == "") {
                       $("#popupDialog").popup("open");
                   }
                   else {
                       mm.update(data).show();
                   }
               }
           
           });

        });

    });

</script>
<div data-role="page">
    <div data-role="header" data-theme="b">
        <a href="#" data-rel="back" data-icon="back" data-theme="e">返回</a>
        <h1>预约</h1>
    </div>
    <div data-role="content">
        <div class="ui-corner-all custom-corners">
            <div class="ui-bar ui-bar-a">
                <h3>进口委托</h3>
            </div>
            <div class="ui-body ui-body-a">
                <p>门点:@Model.Address</p>
                <p>箱型:@Model.CntType</p>
                <p>送货时限:@Model.inconsig.DeliverTime</p>
                <p>运输日期:@Model.inconsig.PlanDt.ToShortDateString()</p>
                <form id="subform" method="post">
                    <input type="hidden" name="orderID" value="@Model.Id" />
                    <label for="car">选择车辆:</label>
                    <select name="carnumber" id="carnumber">
                        @{
                            var list = (List<Truck>)ViewBag.vehicle;
                            if (list.Count > 0)
                            {
                                foreach (var item in list)
                                {
                                    <option value="@item.Id">@item.TruckNumber</option>
                                }
                            }
                            else
                            {
                                <option></option>
                            }
                        }
                    </select>
                    <label for="ownerPrice">运费报价:</label>
                    <input type="number" id="price" name="ownerPrice" />
                    <label for="lastdatetime">拖车最晚提箱时间:</label>
                       <div  id="last">
                            <select style="white-space: normal">
                                <option>今天:@Html.Raw(DateTime.Now.ToShortDateString())</option>
                                <option>明天:@Html.Raw(DateTime.Now.AddDays(1).ToShortDateString())</option>
                            </select>
 
                            <select style="white-space: normal">
                                @{
                                    for (int i = 0; i < 24; i++)
                                    {
                                        var hours = "";
                                        if (i < 10)
                                        {
                                            hours = "0" + i;
                                        }
                                        else
                                        {
                                            hours = i.ToString();
                                        }
                                        <option>@(hours + ":00")</option>
                                        <option>@(hours + ":30")</option>
                                    }
                                }
                            </select>
                      </div>                    
                    <a href="#" data-theme="b" id="res" class="ui-btn-corner-all ui-btn ui-btn-icon-left ui-icon-comment" type="button">预约</a>
                </form>
            </div>          
        </div>
    </div>
    <div data-role="popup" id="popupDialog" data-overlay-theme="b" data-theme="b" data-dismissible="false" style="max-width:400px;">
        <div data-role="header" data-theme="a">
            <h1>提示</h1>
        </div>
        <div role="main" class="ui-content">
            <h3 class="ui-title" id="alert">预约已提交，工作人员会尽快回复你。</h3>
            <a href="/Common/Dialog" target="_self" class="ui-btn ui-corner-all ui-shadow ui-btn-a">确定</a>
        </div>
    </div>
</div>
